package com.geetour.columbus.region.dao.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.geetour.columbus.common.exceptions.DAOException;
import com.geetour.columbus.common.model.D.City;
import com.geetour.columbus.common.model.D.District;
import com.geetour.columbus.common.model.D.Province;
import com.geetour.columbus.core.ibatis.SqlMapClientDaoSupportEx;
import com.geetour.columbus.region.dao.IRegionDictDAO;

@SuppressWarnings("unchecked")
@Service
public class RegionDictDAOImpl extends SqlMapClientDaoSupportEx implements IRegionDictDAO {

    @Override
    public List<Province> findAllProvinces() throws DAOException {
        return (List<Province>) this.queryList("findAllProvinces", null);
    }

    @Override
    public List<City> findCitysByProvinceId(Long id) throws DAOException {
        if (id == null) {
            return null;
        }
        return (List<City>) this.queryList("findCitysByProvinceId", id);
    }

    @Override
    public List<District> findDistrictsByCityId(Long id) throws DAOException {
        if (id == null) {
            return null;
        }
        return (List<District>) this.queryList("findDistrictsByCityId", id);
    }

}
